﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {
    import Engine.Helpers.*;
    import Classes.sim.*;

    public class Helicopter extends Vehicle {

        protected static const MIN_SHADOW_ALPHA:Number = 0.35;
        protected static const SHADOW_ELEVATION_THRESHHOLD:Number = 5;
        protected static const SHADOW_NAME:String = "prop_helicopter_shadow";

        protected static var m_numCopters:int = 0;

        protected var m_shadow:FauxDecoration = null;
        protected var m_alwaysOnTop:Boolean = false;
        protected var m_showShadow:Boolean = true;
        protected var m_depthSwapObject:MapResource;
        protected var m_depthIndexOffset:Number = 0;

        public function Helicopter(_arg1:String, _arg2:Boolean){
            super(_arg1, _arg2);
            this.m_shadow = new FauxDecoration(Helicopter.SHADOW_NAME);
            this.m_shadow.setOuter(Global.world);
            this.m_shadow.alpha = MIN_SHADOW_ALPHA;
            this.m_depthIndexOffset = Helicopter.m_numCopters;
            Helicopter.m_numCopters++;
            this.actionSelection = new CopHelicopterActionSelection(this);
        }
        public function get depthSwapObject():MapResource{
            return (this.m_depthSwapObject);
        }
        public function set depthSwapObject(_arg1:MapResource):void{
            this.m_depthSwapObject = _arg1;
        }
        public function get alwaysOnTop():Boolean{
            return (this.m_alwaysOnTop);
        }
        public function set alwaysOnTop(_arg1:Boolean):void{
            this.m_alwaysOnTop = _arg1;
        }
        public function get showShadow():Boolean{
            return (this.m_showShadow);
        }
        public function set showShadow(_arg1:Boolean):void{
            this.m_showShadow = _arg1;
        }
        public function addScene(_arg1:Vector3):void{
            (this.actionSelection as CopHelicopterActionSelection).addTargetScene(_arg1);
        }
        override public function loadObject(_arg1:Object):void{
            super.loadObject(_arg1);
            if (this.m_shadow){
                this.m_shadow.setPosition(m_position.x, m_position.y, 0);
                this.m_shadow.conditionallyReattach(true);
            };
        }
        override public function setPosition(_arg1:Number, _arg2:Number, _arg3:Number=0):void{
            super.setPosition(_arg1, _arg2, _arg3);
            if (this.m_shadow){
                this.m_shadow.setPosition(_arg1, _arg2, 0);
                this.m_shadow.alpha = (this.m_showShadow) ? (MIN_SHADOW_ALPHA + (Math.max(0, (1 - MIN_SHADOW_ALPHA)) * (1 - Math.min(1, (_arg3 / SHADOW_ELEVATION_THRESHHOLD))))) : 0;
                this.m_shadow.conditionallyReattach(true);
            };
        }
        override public function rotate():void{
            super.rotate();
            if (this.m_shadow){
                this.m_shadow.setPosition(m_position.x, m_position.y, 0);
                this.m_shadow.conditionallyReattach(true);
            };
        }
        override public function attach():void{
            super.attach();
            if (this.m_shadow){
                this.m_shadow.attach();
            };
        }
        override public function detach():void{
            super.detach();
            if (this.m_shadow){
                this.m_shadow.detach();
            };
        }
        override public function get depthIndex():Number{
            if (this.m_alwaysOnTop){
                return ((-100000 - this.m_depthIndexOffset));
            };
            if (this.m_depthSwapObject){
                return (super.depthIndex);
            };
            return (super.depthIndex);
        }

    }
}//package Classes 
